using System;
using System.Collections.Generic;
using System.Text;
using Shc.Sql;
using Shc.Json;
namespace Slqj.Data
{
	public static class TableHoliday
	{
		public const string Table = "Holiday";
		public const string HolidayID = "HolidayID";
		public const string HolidayName = "HolidayName";
		public const string StartDate = "StartDate";
		public const string EndDate = "EndDate";
	}
	
	[Serializable]
	public class BaseHoliday
		: IDbSessionEntity, IJsonClass
	{
		int m_HolidayID;
		/// <summary>
        /// 节日表ID
        /// </summary>
        public int HolidayID
        {
            get { return m_HolidayID; }
            set { m_HolidayID = value; }
        }
		
		string m_HolidayName;
		/// <summary>
        /// 节日名称
        /// </summary>
        public string HolidayName
        {
            get { return m_HolidayName; }
            set { m_HolidayName = value; }
        }
		
		DateTime m_StartDate;
		/// <summary>
        /// 开始时间
        /// </summary>
        public DateTime StartDate
        {
            get { return m_StartDate; }
            set { m_StartDate = value; }
        }
		
		DateTime m_EndDate;
		/// <summary>
        /// 结束时间
        /// </summary>
        public DateTime EndDate
        {
            get { return m_EndDate; }
            set { m_EndDate = value; }
        }
		
		
		#region IDbSessionEntity Members
		public void ReadDBData(RowDataReader reader)
        {
            m_HolidayID = reader[TableHoliday.HolidayID];
            m_HolidayName = reader[TableHoliday.HolidayName];
            m_StartDate = reader[TableHoliday.StartDate];
            m_EndDate = reader[TableHoliday.EndDate];
        }
		
		public void WriteDBData(RowDataWriter writer)
        {
            writer.SetPrimaryKey(TableHoliday.HolidayID, PrimaryKeyType.Identity, HolidayID);
			writer[TableHoliday.HolidayName] = HolidayName;
			writer[TableHoliday.StartDate] = StartDate;
			writer[TableHoliday.EndDate] = EndDate;
        }

        public void SetIdentityAfterInsert(DBObject idd)
        {
            m_HolidayID = idd;
        }
		
		public string TableName
        {
            get { return TableHoliday.Table; }
        }
		#endregion
		
		#region IJsonClass Members

        public void JsonDeSerializeObj(JsonHashTable hashToRead)
        {
             m_HolidayID = hashToRead["HolidayID"];
			 
             m_HolidayName = hashToRead["HolidayName"];
			 
             m_StartDate = hashToRead["StartDate"];
			 
             m_EndDate = hashToRead["EndDate"];
			 
        }

        public void JsonSerializeObj(JsonHashTable hashToFill)
        {
            hashToFill["HolidayID"] = HolidayID;
			 
            hashToFill["HolidayName"] = HolidayName;
			 
            hashToFill["StartDate"] = StartDate;
			 
            hashToFill["EndDate"] = EndDate;
			 
        }

        #endregion
		
	}
}
